<?php
namespace app\admin\controller;
use think\Db;

class Log extends Main
{
    /**
     * 接口访问记录
     */
    public function apilog()
    {
    	$where = [];
        $keyword = $this->request->param('keyword');
        if($keyword){
            $where[] = ['api|status|message|inParam|outParam','like','%'.$keyword.'%'];
        }
    	$begin = $this->request->param('begin');
        $end = $this->request->param('end');
        if($begin || $end){
            $where[] = search_time('createtime',$begin,$end);
        }
        $data = Db::name('apilog')
        	->where($where)
            ->order('id desc')
            ->paginate(15, false, [
            'query' => request()->param()]);
        $this->assign('list',$data);
        return $this->fetch();
    }
}